<?php

$__FILEPATH__ = dirname(__FILE__)."/";

require_once($__FILEPATH__."../func_common.php");
require_once($__FILEPATH__."../class_def.php");
require_once($__FILEPATH__."../conf/info.php");
CheckAdminAndInitHeader();

$mysqli = GetMysqliInstance();

if (isset($_POST["algo_add"]))
{
	if ($_POST["name"] == "")
		die("名称不能为空");
	$type 	= "algorithm";
	$name 	= $_POST["name"];
	$intra 	= $_POST["intra"];
	$stmt = $mysqli->prepare("insert into classlist(type, name, intra) values(?,?,?)");
	$stmt->bind_param("sss", $type, $name, $intra);
	if (!$stmt->execute())
		die("添加失败~");
	else
	{
		echo ("<span tyle='color:green'> 添加成功！</span><br />");
		echo ("<a href='./blog_add_class.php'>继续添加</a>");
		exit(0);
	}
}

$mysqli->close();

?>